package org.jspar.partition;

import org.jspar.Options;

/**
 * VARIANT 2:  A partition is acceptable if the ratio of the number
 * of connections to the number of modules is greater than some value
 * partition_ratio (set by the -r flag).
 */
public class RentLikeRule extends PartitionRule {

	public RentLikeRule(Options options) {
		super(options);
	}

	public boolean isAcceptable(Cluster ci, Cluster cj, int c) {
		double ratio = (double) c / (ci.size() + cj.size());
		return ratio >= configuration.partitionRatio;
	}
}
